package com.sds.thesis;

import com.deepoove.poi.XWPFTemplate;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;

import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;

public class main {
    @Test
    public void test() throws Exception{
        ClassPathResource resource = new ClassPathResource("thesis/template.docx");
        InputStream inputStream = resource.getInputStream();
        XWPFTemplate template = XWPFTemplate.compile(inputStream).render(
                new HashMap<String, Object>() {{
                    put("projectName", "测试项目");
                }});
        template.writeAndClose(Files.newOutputStream(Paths.get("output.docx")));
    }
}
